class CObject(object):
    def __init__(self, parent):
        self.parent = parent
        self.signals = []

        from gui.CGuiApplication import CGuiApplication
        CGuiApplication.add(self)

    def connect(self, signal, slot):
        self.signals.append((str(signal), slot))

    def slot(self, signal):
        for sig in self.signals:
            if sig[0] != str(signal):
                continue
            if not sig[1]:
                continue
            return sig[1]
        return None

    def dispatch(self, sender, signal, *args, **kwargs):
        for sig in self.signals:
            if sig[0] != str(signal):
                continue
            if not sig[1]:
                continue
            sig[1](*args, **kwargs)

    def draw(self):
        pass

    def draw_hover(self):
        pass

    def event(self, msg, param):
        return False
